// pages/coal/coal.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    time_sort:0,//时间排序状态（0为升序,1为降序）
    city_sort:0,
    reward: [
 
    ],
    choseB: [
      { baby: '大块' },
      { baby: '大块' },
      { baby: '大块' },
      { baby: '大块' },
    ],
    list: [
      {
        pagePath: "/pages/index/index",
        text: "货运大厅",
        iconPath: "/images/index_02.png",
        selectedIconPath: "/images/index_01.png",
        selected: false
      },
      {
        pagePath: "/pages/options/options",
        text: "车源",
        iconPath: "/images/index_04.png",
        selectedIconPath: "/images/index_03.png",
        selected: false
      },
      {
        pagePath: "/pages/release/release",
        text: "发布",
        iconPath: "/images/index_fa.png",
        selectedIconPath: "/images/index_fa1.png",
        selected: false
      },
      {
        pagePath: "/pages/coal/coal",
        text: "煤炭",
        iconPath: "/images/index_06.png",
        selectedIconPath: "/images/index_05.png",
        selected: true,
        selectedColor: "#a1dbff"
      },
      {
        pagePath: "/pages/my/my",
        text: "我的",
        iconPath: "/images/index_08.png",
        selectedIconPath: "/images/index_07.png",
        selected: false
      }
    ],
    buytype:false,
    tabbarIndex:''
  },
  //煤炭详情
  coalde(){
    app.navTo('../coalde/coalde')
  },
  // 煤炭类型选择
  chose_baby: function (e) {
    var index = e.currentTarget.dataset.index;
    var buytype = this.data.buytype;
    buytype = false;
    this.setData({
      buytype: buytype
    })
  },
  changesx: function (e) {
    var that = this;
    var time_sort = that.data.time_sort;
    if (time_sort == 0){
      that.setData({
        time_sort: 1  
      })
    } else if (time_sort == 1){
      that.setData({
        time_sort: 0
      }) 
    }
  },
  changesd: function (e) {
    var that = this;
    var city_sort = that.data.city_sort;
    if (city_sort == 0) {
      that.setData({
        city_sort: 1
      })
    } else if (city_sort == 1) {
      that.setData({
        city_sort: 0
      })
    }
  },
  typebuy: function () {
    this.setData({
      buytype: !this.data.buytype
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //显示自定义的底部导航
    if (options.id == 1) {
      this.setData({
        tabbarIndex: options.id
      })
      getApp().editTabBar1();
    } else {
      getApp().editTabBar();
    }
 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})